package cn.com.bluemoon.daps.standard.client;

import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.api.sys.RemoteSystemBizLineService;
import cn.com.bluemoon.daps.system.vo.BizLineResponseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @author Jarod.Kong
 */
@Service
@Slf4j
public class DapSystemModuleFacade {

    @Resource
    RemoteSystemBizLineService dapSystemBizLineService;

    public BizLineResponseVo getBizLineInfoById(Integer bizLineId) {
        ResultBean<BizLineResponseVo> bizLineR;
        try {
            bizLineR = dapSystemBizLineService.getById(bizLineId + "");
            return bizLineR.getContent();
        } catch (Exception e) {
            log.error("bizLineId={},获取业务线信息失败", bizLineId, e);
        }
        return null;
    }

    public List<BizLineResponseVo> listBizLines() {
        try {
            ResultBean<List<BizLineResponseVo>> res = dapSystemBizLineService.bizLines();
            return res.getContent();
        } catch (Exception e) {
            log.error("获取业务线列表失败", e);
        }
        return Collections.emptyList();
    }


}
